﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ConceptsFramework.AbstractConceptElements;
using Caliburn.PresentationFramework;

namespace ConceptsFramework.ConceptResults
{
    /// <summary>
    /// DPL query result set representation
    /// </summary>
    public class ResultSet
    {
        public ResultSet()
        {
        }

        public ResultSet(AbstractBindableConcept aConcept)
        {
            CurrentSet.Add(aConcept);
        }

        public string Name
        {
            get;
            set;
        }

        public ResultSet(List<AbstractBindableConcept> Concepts)
        {
            CurrentSet.AddRange(Concepts);
        }

        public int ResultSetDepth { get; set; }

        private BindableCollection<ResultSet> _InnerSet;
        /// <summary>
        /// Nested result sets
        /// </summary>
        public BindableCollection<ResultSet> InnerSet
        {
            get
            {
                if (_InnerSet == null)
                    _InnerSet = new BindableCollection<ResultSet>();
                return _InnerSet;
            }
            set { _InnerSet = value; }
        }

        private BindableCollection<AbstractBindableConcept> _CurrentSet;

        /// <summary>
        /// Direct concepts found
        /// </summary>
        public BindableCollection<AbstractBindableConcept> CurrentSet
        {
            get
            {
                if (_CurrentSet == null)
                    _CurrentSet = new BindableCollection<AbstractBindableConcept>();
                return _CurrentSet;
            }
            set { CurrentSet = value; }
        }
    }
}
